Clever code is difficult to understand. “Clever code” can stem from valuing complex code over readability, premature abstraction, or over-adherence to the DRY (Don't Repeat Yourself) principle. Devs should instead try to write simple code that their future selves can easily understand.
Monday, May 27, 2024A three-step process for writing clean code: first, prioritize making the code work, then add testing for correctness, and finally, refactor and clean up the code while relying on the tests.
Shipping something, even a minor change, in your code every day provides a dopamine rush and creates momentum. It also makes you more personally satisfied and shows productivity to your team and manager.
Great contributions to a codebase prioritize well-tested features over rushed solutions, have TODOs and feature flags to manage ongoing work, and refactor existing code in-place whenever possible. New changes should be broken down into digestible pull requests. They should also have the same patterns and code style of the existing codebase.
This developer encountered a Pascal code snippet for disk parking at a young age but couldn't understand it. The code was filled with seemingly arbitrary numbers and letters and it frustrated the developer. Upon revisiting it decades later, the developer realized that the code was essentially just invoking a system call, using registers and arguments specific to the BIOS. It goes to show how experience and knowledge gained in the field can often be subtle but dramatic in approaching complex code and situations.
Apple introduced new tools for developers at WWDC24. Xcode 16 introduces Swift Assist with predictive code completion for faster development. Swift 6 has features like compile-time data-race safety for a better dev experience. visionOS 2 has new APIs and frameworks. There are also updates to the Game Porting Toolkit 2 to make game development easier for Apple devices.
The most productive solo dev stack is the one that you can code the fastest in.
A developer working on an autonomous driving system encountered an issue where a new, faster camera made the tracking system worse. The root cause was a preprocessor directive for the framerate, which was mistakenly defined as an integer and not a floating-point number due to a missing decimal point. This caused the sampling time to be calculated as zero, leading to incorrect position predictions by the Kalman filter.
Cognitive load is how much mental effort a developer needs to understand code. High cognitive load is caused by complex code structures and excessive use of features. To reduce cognitive load, developers should prioritize simplicity over complexity, use deep modules with simple interfaces, and avoid an over-reliance on frameworks.
Friction is the difference between theoretical plans and reality. It is caused by unexpected issues like bugs, changing requirements, or technical failures. Friction can compound in longer timelines, making each subsequent issue harder to deal with. Teams and developers should deal with friction early by planning smaller iterations, having more redundancy, and automating things properly.
Local-first software stores and processes data locally on users' devices while using the internet for backup when connected. Resilient Sync uses a simple log format to track changes and assets, allowing offline data processing and easy sync across devices. It offers independence from push notifications, the ability to load entries without knowing their content, easy detection of missing data, and the option for data replication and peer-to-peer synchronization.
There may be a potential decrease in demand for junior developers due to the rise of AI-powered coding assistants like ChatGPT. Junior developers should focus on learning fundamentals like algorithms, data structures, and system design, rather than just programming languages. They should also learn to work well with AI assistants, as senior developers who can effectively guide and review AI-generated code will eventually be more valuable.
This library provides convenient access to the Anthropic REST API from server-side TypeScript or JavaScript.
Dependency Injection (DI) is a design pattern that improves flexibility, testability, and maintainability by injecting external dependencies into your code rather than hard-coding them. In React applications, DI can be implemented using createContext and useContext to manage dependencies across components without prop drilling. This approach simplifies testing, makes code less coupled, and provides better separation of concerns, though it does add some complexity.
Daniel Beck, a seasoned developer, shares his personal experiences with XSLT, inefficient database connections, and disastrous refactoring efforts. His experience with horrific codebase complexity only reinforced how hard it can be to rectify human errors.
- Rails 7.2 introduces performance improvements and better defaults, enhancing development experience.
Rails 7.2 has better production defaults, performance boosts with YJIT enabled by default, optimized Puma settings, and easier setup with pre-configured development containers.
Kiota is a command line tool for generating an API client to call any OpenAPI described API you are interested in.